fix(security): patch copilot tool & multipart upload IDORs#4304
fix(security): patch copilot tool & multipart upload IDORs#4304waleedlatif1 merged 3 commits intostagingfrom
Conversation
- multipart upload: bind upload session to (userId, workspaceId, key) via short-lived HMAC-signed token; require workspace write access at initiate; source key/uploadId/context from verified token (never client) at get-part-urls/complete/abort - copilot knowledge-base tools: gate all 11 read/write/tag/connector ops with checkKnowledgeBaseAccess / checkKnowledgeBaseWriteAccess - copilot user-table tools: add workspace-id check to get, get_schema, add/rename/delete/update_column to match existing op pattern - copilot manage-credential: add full ownership/write-permission auth via getCredentialActorContext (previously had no auth) - copilot restore-resource: verify workspace ownership and write permission for workflow, table, knowledgebase, file, and folder restores - copilot folder rename/move: verify both folderId and parentId belong to the caller's workspace via new verifyFolderWorkspace helper - copilot get-job-logs: verify schedule belongs to caller's workspace
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Copilot tools now enforce workspace-scoped access before mutating or returning data: credential rename/delete is gated via Reviewed by Cursor Bugbot for commit 3f7a3ba. Configure here. |
Greptile SummaryThis PR patches a set of IDOR and missing-authorization vulnerabilities across the multipart upload API and a wide range of copilot tool handlers. The multipart upload fix is particularly well-designed: sessions are now bound to a short-lived HMAC-SHA256-signed token ( The copilot handler fixes are comprehensive — knowledge-base (11 ops), user-table (6 ops), manage-credential, restore-resource, folder move/rename, and get-job-logs are all gated with appropriate access checks. The logic throughout is consistently fail-closed. The only minor concern is the fixed 1-hour upload-token TTL, which could cause token expiry for very large uploads before the session completes. Confidence Score: 5/5Safe to merge — all IDORs are patched with fail-closed logic and no new regressions introduced No P0 or P1 findings. The security fixes are correct and comprehensive; the only open item is a P2 TTL concern for very large uploads. Previous review threads confirm earlier edge cases (split limit, log count) were addressed in a prior commit. No files require special attention; upload-token.ts TTL default is worth a second look if multi-hour large file uploads are a real-world scenario Important Files Changed
Sequence DiagramsequenceDiagram
participant C as Client
participant API as Multipart API
participant Auth as Workspace ACL
participant Token as HMAC Signer
participant Store as Cloud Storage
C->>API: initiate {fileName, workspaceId, context}
API->>Auth: check write permission
Auth-->>API: allowed
API->>Store: start upload session
Store-->>API: uploadId + path
API->>Token: sign session payload (1h TTL)
Token-->>API: uploadToken
API-->>C: uploadId, path, uploadToken
C->>API: get-part-urls {uploadToken, partNumbers}
API->>Token: verify token + userId
Token-->>API: session payload
API->>Store: generate presigned part URLs
API-->>C: presignedUrls
C->>Store: PUT chunks via presigned URLs
C->>API: complete {uploadToken, parts}
API->>Token: verify token + userId
Token-->>API: session payload
API->>Store: finalize upload
API-->>C: success + location
Reviews (3): Last reviewed commit: "fix(security): close folder workspace by..." | Re-trigger Greptile |
- knowledge-base delete_document/update_document: verify each document belongs to the claimed knowledgeBaseId via checkDocumentWriteAccess (was: trusted args.knowledgeBaseId without binding it to the document) - multipart batch complete: log verifiedEntries.length instead of raw client-supplied data.uploads.length - upload-token: reject tokens with !=2 dot-delimited segments
|
@greptile |
|
@cursor review |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 3f7a3ba. Configure here.
Summary
(userId, workspaceId, key)via short-lived HMAC-signed token; require workspace write access at initiate; source key/uploadId/context from the verified token (never client) at get-part-urls/complete/abortcheckKnowledgeBaseAccess/checkKnowledgeBaseWriteAccessget,get_schema,add/rename/delete/update_columnto match existing op patterngetCredentialActorContext(previously had no auth)folderIdandparentIdbelong to the caller's workspace via newverifyFolderWorkspacehelperType of Change
Testing
Tested manually. Typecheck clean and full test suite (5337 tests) passing.
Checklist